package com.homework05;

/*
需求： 把找出数组的最大值案例，改造成方法getMax，
可以支持返回任意整型数组的最大值数据。
*/
public class work09 {
    public static void main(String[] args) {
        int[] arr = {11, 22, 33, 44, 2, 5, 787, 56, 35, 78};
        int resoult = maxsix(arr);
        System.out.println("数组的最大值为:" + resoult);
    }

    public static int maxsix(int[] arr) {
        int max = arr[0];
        System.out.print("数组：");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(+arr[i] + " ");
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        System.out.println();
        return max;
    }
}
